#ifndef D_GAME_H
#define D_GAME_H

#include <string>
#include <map>

#include <helpers\game\engine.h>
#include <helpers\game\screen.h>
#include <managers\event\event_manager.h>

using namespace DelGE::Modules::System;
using namespace DelGE::Modules::Graphics;
using namespace DelGE::Modules::Input;
using namespace DelGE::Modules::Audio;
using namespace DelGE::Managers::Event;
using namespace DelGE::Helpers::Math;

using namespace std;

namespace DelGE
{
	namespace Helpers
	{
		namespace Game
		{
			class Game
			{
			protected:
				Engine* pEngine;

				SystemWindow* pGameWindow;
				GraphicsContext* pContext;
				int iBitDepth;

				SystemVideoMode oDesktopMode;

				bool bIsFullscreen;
				bool bHideMouse;
				bool bIsRunning;
				bool bHasFocus;

				map<int, Screen*> mScreenMap;
				Screen* pCurrentScreen;

			public:
				Game();
				virtual ~Game();

				virtual void Startup() = 0;
				virtual void Shutdown() = 0;
				virtual void Update(float fDelta) = 0;
				virtual void Render() = 0;

				void Run(int iScreenIndex);

				void AddScreen(int iScreenIndex, Screen *pScreen);
				void RemoveScreen(int iScreenIndex); // No idea why you'd do this.

				void CreateGraphicsWindow(string sTitle, int iWidth, int iHeight, int iBitDepth = 32, bool bFullscreen = false);
				void DestroyGraphicsWindow();

				void ToggleFullscreen(); // If we are fullscreen, go windowed, else go fullscreen
				void SwitchToFullscreen();
				void SwitchToWindowed();

				void HideMouse();
				void ShowMouse();

				int GetGraphicsWidth();
				int GetGraphicsHeight();
				int GetGraphicsBitDepth();

				void RenderCurrentScreen();
				void UpdateCurrentScreen(float fDelta);

				Engine* GetEngine();
			};
		}
	}
}

#endif